package in.co.codedoc.sql.mapping;

import java.sql.ResultSet;
import java.sql.SQLException;

import in.co.codedoc.sql.DBOutputColumnMap;
import in.co.codedoc.sql.SQLStatement;

public class DoubleDoubleOutputColumnMap 
	extends DBOutputColumnMap
	implements DoubleOutputColumnMap 
{
	public static DBOutputColumnMap GetDBOutputColumnMap()
	{
		return new DoubleDoubleOutputColumnMap();
	}

	@Override
	public void ReadColumn(int index, ResultSet rs) 
		throws SQLException
	{
		v = rs.getDouble(index);
		
		if(Logger.logger.isDebugEnabled())
		{
			if(index > 1)
			{
				SQLStatement.GetDebugStringBuffer().append(",");
			}
		}
		
		if(rs.wasNull())
		{
			if(Logger.logger.isDebugEnabled())
			{
				SQLStatement.GetDebugStringBuffer().append("<NULL>");
			}
			
			SetWasNull();
		}
		else
		{
			if(Logger.logger.isDebugEnabled())
			{
				SQLStatement.GetDebugStringBuffer().append(v);
			}			
		}
	}
	
	public double GetValue()
	{
		return v;
	}
	
	private double v;
}
